<template>
	<view class="notice-page">
		<view class="tabs">
			<u-tabs :list="tablist" :inactiveStyle="inactiveStyle" :activeStyle="activeStyle" :itemStyle="itemStyle"
				@click="tabsclick"></u-tabs>
		</view>
		<view class="collapse">
			<u-collapse @change="change" :border="false" @close="close" @open="open">
				<u-collapse-item :title="item.title" v-for="(item,index) in noclist" :key="index">
					<text class="u-collapse-content" v-html="item.content"></text>
				</u-collapse-item>
			</u-collapse>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				itemStyle: {
					width: '33%',
					height: '72rpx',
					textAlign: 'center'
				},
				inactiveStyle: {
					color: '#666666',
					fontSize: '28rpx'
				},
				activeStyle: {
					fontSize: '28rpx',
					color: '#67aedc'
				},
				tablist: [],
				noclist:[],
				id:'1'
			}
		},
		onLoad() {
			this.posttab()
			this.postnoc()
		},
		methods: {
			posttab(){
				this.$Request({
					method: 'POST',
					url: '/notice/getCateList'
				}).then(res => {
					if (res.data.code == 1) {
						this.tablist = res.data.data
					}
				})
			},
			postnoc(){
				uni.showLoading({
					mask:true
				})
				let params = {
					cate_id: this.id
				}
				this.$Request({
					method: 'POST',
					data: params,
					url: '/notice/getNoticeList'
				}).then(res => {
					if (res.data.code == 1) {
						uni.hideLoading()
						console.log(res)
						this.noclist = res.data.data.data
					}
				})
			},
			tabsclick(e) {
				this.id = e.id
				this.postnoc()
			},
			open(e) {
				console.log('open', e)
			},
			close(e) {
				console.log('close', e)
			},
			change(e) {
				console.log('change', e)
			}
		}
	}
</script>

<style scoped lang="scss">
	.notice-page {
		.collapse{
			padding: 30rpx;
		}
	}
</style>